﻿/// <reference path="jquery-1.7-vsdoc.js" />


//new  ;
//constructor change;


$(".Mdetail").each(function () {
    var dataLines = $("tbody", $(this)).children();
    //此页所含数据的条数，并减去表头。
    var dataLength = dataLines.length - 1;
    for (var i = 0; i < everyPageCount - dataLength; i++) {
        var lineHeight = $(dataLines[1]).css("line-height");
        var fontSize = $(dataLines[1]).css("font-size");
        var brObject = $("<br/>");
        brObject.css("line-height", lineHeight);
        brObject.css("font-size", fontSize);
        $(".content", $(this).parent().parent().parent()).after(brObject);
    }
});


var w = window.screen.width - 50;
var h = window.screen.height - 100;
window.moveTo(25, 25);
window.resizeTo(w, h);
$(document).ready(function () {
    //分页符
    $('div[id$="Footer"]').css("pageBreakAfter", "always");
    //Stock Name 变红
    $(".StockName").css("color", "red");

    //remove the content div
    //$("div[id$='content']").remove();
    var object = $("#ApplicationLayout");
    $("body").empty();
    $("body").append(object);


    var everyPageCount = $("input[id$='EveryPageCountHiddenField']").val();

    $(".Mdetail").each(function () {
        var dataLines = $("tbody", $(this)).children();
        //此页所含数据的条数，并减去表头。
        var dataLength = dataLines.length - 1;

        var lineHeight = $(dataLines[1]).css("line-height");
        var fontSize = $(dataLines[1]).css("font-size");
        for (var i = 0; i < everyPageCount - dataLength; i++) {
            var brObject = $("<br/>");
            brObject.css("line-height", lineHeight);
            brObject.css("font-size", fontSize);
            $(".content", $(this).parent().parent().parent()).after(brObject);
        }
    });

    //处理disable的对象的显示，去除其灰色不清晰。
    $('input[id$="tbToBeDeliveredDate"]', $(".ap_info")).datepicker({ disabled: true });
    $("input:disabled", $(".ap_info")).removeAttr("disabled");
    $("select:disabled", $(".ap_info")).removeAttr("disabled");
    $("select", $(".ap_info")).each(function () {
        var object = $('<input type="text" />');
        object.val($(this).val());
        object.addClass("text");
        $(this).replaceWith(object);
    });
    $("input", $(".ap_info")).attr("readOnly", "true");
    $(".image", $(".ap_info")).remove();

    //Remove *
    $("span", $(".ap_info")).filter(function () {
        var content = $(this).html();
        return content.indexOf("*") != -1;
    }).remove();

    window.print();
});

window.onbeforeprint


function ClassA(color) {
    this.color = color;
}

ClassA.prototype.sayColor = function () {
    alert(this.color);
}

function ClassB(color, name) {
    ClassA.call(this, name);
    this.name = name;
}

ClassB.prototype = new ClassA();

ClassB.prototype.sayName = function () {
    alert(this.name);
}


var b = new ClassB("Red", "William");
var isA = b instanceof ClassA;
var isB = b instanceof ClassB;
b.constructor = ClassB;
isA = b instanceof ClassA;
isB = b instanceof ClassB;

//b.sayColor();
//b.sayName();
//alert(b.constructor.toString());


function NewObject1() {
    var object = new Object();
    object.name = "William1"
    return object;
}

function NewObject2() {
    this.name = "William2";
}

function NewObject3() {
    var name = new Object();
    name.name = "William3";
    this.name = name;
}


var object3 = new NewObject3();

var temp = object3;


function IsArray(object) {
    return typeof object === "object" && "pop" in object;
}

$(document).ready(function () {
    //    window.print();
    //    $(window).bind("onafterprint", function () {
    //        alert("Hello");
    //    });
    $("li.item-2").closest("li").css("background-color", "red");


    var iObject = new Object();
    iObject.Name = "William";
    iObject.Age = "vlaue";

    var iObject1 = $.map(iObject, function (value, key) {
        return value;
    });

    var re = /(A?(B?(C?)))/;
    /*上面的正则表达式将依次产生三个分组
    (A?(B?(C?))) 最外面的
    (B?(C?))
    (C?)*/
    str = "ABC";
    re.test(str); //反向引用被存储在RegExp对象的静态属性$1—$9中
    //alert(RegExp.$1 + "\n" + RegExp.$2 + "\n" + RegExp.$3);
    //反向引用也可以在正则表达式中使用\1 ,\2...这类的形式使用
    re = /\d+(\D)\d+\1\d+/;
    str = "2008-1-1";
    var result1 = re.exec(str);
    //alert(re.test(str)); //true
    str = "2008-4_3";
    //alert(re.test(str)); //false
    var result2 = re.exec(str);



    var isArray1 = $.isArray(iObject1);

    var type1 = typeof iObject;
    var type2 = typeof iObject1;
    var isarray = IsArray(iObject1);

    var elementDocument = document.documentElement.doScroll();
    var re = /^\w{1,15}(@(?!-))(([a-z0-9-]*)([a-z0-9](?!-))(\.(?!-)))+[a-z]{2,4}$/;
    var reg = new RegExp("validate\\[(.*)\\]");

    var strtemp = reg.exec("validate[required,equals[password]] text-input");
    var strtempsub = strtemp.$1;
    var str = /validate\[(.*)\]/.exec("validate[required,equals[password]] text-input");
    //var str = /validate\[(?:.*)\]/.exec("validate[required,equals[password]] text-input");//不返回字表达式
    var str1 = str[1].split(/\[|,|\]/);


    var re = /^\w{1,15}(?:@(?!-))(?:(?:[a-z0-9-]*)([a-z0-9](?!-))(?:\.(?!-)))+[a-z]{2,4}$/;
    var ressut = re.exec("eee@fds.co-m.con");
    var result = re.test("eee@fds.-com.con");

    var element = document.createElement("input");
    element.setAttribute("value", "Hello World");



    $(element).insertBefore($("#one"));
    $.ajax("Hello.txt");
});

var ob1 = new Object();
var ob2 = new Object();
ob1.ob1 = "william"
ob2.ob2 = 12;
var ob3 = null;
var ob4 = undefined;
var ob5 = true;

var o1 = ob1 && ob2;
var o2 = ob2 && ob1;
var o3 = ob1 && ob3;
var o4 = ob3 && ob1;
var o5 = ob1 && ob4;
var o6 = ob4 && ob1;
var o7 = ob5 && ob1;
var o8 = ob1 && ob5;
var o9 = ob3 && ob3;
var o10 = ob4 && ob4;
//document.write(ob1.name);//以上，两个都为对象返回第二个，或返回其假者.
var o1 = ob1 || ob2;
var o2 = ob2 || ob1;
var o3 = ob1 || ob3;
var o4 = ob3 || ob1;
var o5 = ob1 || ob4;
var o6 = ob4 || ob1;
var o7 = ob5 || ob1;
var o8 = ob1 || ob5;
var o9 = ob3 || ob3;
var o10 = ob4 || ob4;
//document.write(ob1.name); //以上，两个都为对象返回第一个，或返回其真者.
var o1 = !ob1;
var o2 = !ob2;
var o3 = !ob3;
var o4 = !ob4;
var o5 = !ob5;
//document.write(ob1.name);



//    私有属性和方法：函数有作用域，在函数内用var 关键字声明的变量在外部无法访问，私有属性和方法本质就是你希望在对象外部无法访问的变量。
// 
//　　特权属性和方法：创建属性和方法时使用的this关键字，因为这些方法定义在构造器的作用域中，所以它们可以访问到私有属性和方法；只有那些需要直接访问私有成员的方法才应该被设计为特权方法。
// 
//　　共有属性和方法：直接链在prototype上的属性和方法，不可以访问构造器内的私有成员，可以访问特权成员，子类会继承所有的共有方法。
// 
//　　共有静态属性和方法：最好的理解方式就是把它想象成一个命名空间，实际上相当于把构造器作为命名空间来使用。




function MyObject() {
    var Property1 = 1;
    var Method1 = function () {
        document.write("Method1");
    }  //私有

    this.Property2 = 2;
    this.Method2 = function () {
        document.write("Method2");
    } // 特权
}

MyObject.prototype.Property4 = 4;
MyObject.prototype.Method4 = function () {
    document.write("Method4");
}; ; //共有


MyObject.Property3 = 3;
MyObject.Method3 = function () {
    document.write("Method3");
}; //静态


var i = 1 != 1 ? 1 : 2 != 2 ? 2 : 3;
//alert(i);

